package jenry.handlertest;

import android.app.Activity;
import android.os.Bundle;

public class Gan_HandlerTest extends Activity {
    /** Called when the activity is first created. */
	//private Handler handler = new Handler();
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //handler.post(r);
        setContentView(R.layout.main); 
        
        try{
        	Thread.sleep(1000);
        }catch(InterruptedException e){
        	e.printStackTrace();
        }
        System.out.println("a--->" + System.currentTimeMillis());
		Thread t = new Thread(r) ;
		t.start();
		System.out.println("activity--->" + Thread.currentThread().getId());
		System.out.println("activityname--->" + Thread.currentThread().getName());
		
    }
    
    Thread r = new Thread(){

    	@Override
		public void start() {
			System.out.println("start----------");
			super.start();
		}
    	
		@Override
		public void run() {
			System.out.println("r1--->" + System.currentTimeMillis());
			System.out.println("handlerId--->" + Thread.currentThread().getId());
			System.out.println("handlerName---" + Thread.currentThread().getName());
			try{
				Thread.sleep(10000);
				System.out.println("r2--->" + System.currentTimeMillis());
			}catch(InterruptedException e){
				e.printStackTrace();
			}
		}
    };
}